<template>
	<view class="">
		<view class="money">
			<text style="font-size: 28rpx;margin-bottom: 20rpx;">可用余额 </text>
			<view class="">
				<u-count-to :start-val="0" :end-val="info || '0'"></u-count-to>
			</view>
		</view>

		<view class="center1">
			<view class="" style="border-top: 1rpx solid #EEEEEE; 
				width: 100%;height: 1rpx;">
			</view>
			<view class="">
				<view class="" style="margin: 20rpx 30rpx 20rpx;">
					充值金额
				</view>
				<view class="seckill-current center-box flex align-center" style="margin-left: 30rpx;">
					<text>￥</text>
					<input type="text" v-model="numInput" placeholder-style="font-size: 24rpx" placeholder="请输入充值金额"
						style="border-bottom: 1rpx solid #EEEEEE;
					display: inline-block;" />
				</view>
			</view>

			<!-- <button class="cu-btn author-btn" @getuserinfo="getuserinfo" open-type="getUserInfo">授权并查看</button> -->

		</view>


		<view class="add-text" @tap="add">
			立即充值
		</view>
	</view>
</template>

<script>
	import {
		mapMutations,
		mapActions,
		mapState
	} from 'vuex';
	// import pay from '@/common/shopro-pay.js'

	import wxsdk from '@/common/wechat/sdk'
	import Wechat from '@/common/wechat/wechat'

	export default {
		data() {
			return {
				numInput: '',
				phone: '',
				info: '',
				accountInfo: {},
			}
		},
		onLoad(e) {
			//this.accountInfo = uni.getAccountInfoSync();
			this.getInfo()
			console.log('eeeeeeeeee',e, we)
		},
		methods: {
			goBack() {
				uni.navigateBack({
					delta: 1
				})
			},

			getInfo() {
				this.$api('user.info', {}).then(res => {
					if (res.code == 1) {
						this.info = res.data.money
					}
				})
			},

			// 转账
			add() {
				 let wechat = new Wechat();
				 wechat.wxOfficialAccountBaseLogin();
				 
				 
				// this.$api('user.recharge',{
				// 	num: this.numInput,
				// 	recharge_set_id: this.recharge_set_id ? this.recharge_set_id : '0',
				// }).then(res => {
				// 	if(res.code == 1) {
				// 		console.log("111: ",111);
				// 		this.numInput = ''

				// 		// uni.navigateTo({
				// 		// 	url: '../../order/payment/method?order_sn='+res.data.order_sn,

				// 		// });
				// 		this.pay(res.data.order_sn)
				// 	} 
				// }) 
			},

			getuserinfo(e) {
				console.log(e)
			},


			pay(payinfo) {
				console.log("111: ", 111);
				this.$api('pay.prepay', {
					type: 'recharge',
					order_sn: payinfo,
					payment: 'wechat',
				}).then(res => {
					console.log("res: ", res);
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	.header1 {
		width: 100%;
		height: 120rpx;
		line-height: 120rpx;
		color: #FFFFFF;
		background-color: #fff;
	}

	.money {
		width: 90%;
		margin: 10rpx auto;
		height: 200rpx;
		padding-left: 30rpx;
		font-size: 40rpx;
		background-color: #fff;
	}

	.center1 {
		width: 90%;
		margin: 20rpx auto;
		border-radius: 10rpx;
		background-color: #FFFFFF;

		.center-box {
			width: 80%;
			margin: 0 auto;
			height: 80rpx;
			line-height: 80rpx;
		}
	}

	.add-text {
		position: fixed;
		bottom: 80rpx;
		left: 50%;
		transform: translateX(-50%);
		width: 80%;
		height: 80rpx;
		color: #FFFFFF;
		margin: 0 auto;
		border-radius: 10rpx;
		line-height: 80rpx;
		text-align: center;
		background-color: #a7c4ff;
	}
</style>
